<template>
  <div class="gray-page resident-detail-page">
    <nav-bar title="单位基础信息采集"></nav-bar>
    <div class="resident-detail-main page-main">
      <van-sticky class="page-scroll" :offset-top="44">
        <!-- 1：更新  2：审核  3：采集 -->
        <p class="resident-detail-time" v-if="formParams.updateTime">
          <template v-if="$route.query.queryType === '1'">上次更新时间：</template>
          <template v-if="$route.query.queryType === '2'">上次审核时间：</template>
          <template v-if="$route.query.queryType === '3'">上次采集时间：</template>
          {{ formParams.updateTime }}
        </p>
        <van-form input-align="right" :label-width="138">
          <van-collapse v-model="activeNames" :border="false">
            <van-collapse-item size="large" title="房屋信息" name="1">
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.placeName"
                label="所属场所"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.buildName"
                label="楼栋"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.unitName"
                label="单元"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.floorName"
                label="楼层"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.houseName"
                label="房间号"
              />
            </van-collapse-item>
            <van-collapse-item size="large" title="基础信息" name="2">
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.companyName"
                label="单位名称"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.companyTypeName"
                label="单位类型"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.businessScope"
                label="经营范围"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.isLicenseName"
                label="是否有营业执照"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.licenseNum"
                label="营业执照号"
              />
              <van-field readonly label-class="van-cell__title_gray" v-model="formParams.phone" label="联系方式" />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                required
                v-model="formParams.businessStatusName"
                label="经营状态"
              />
              <van-field
                required
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.keyCompanyName"
                label="重点单位标识"
              />
              <van-field readonly label-class="van-cell__title_gray" v-model="formParams.area" label="面积" />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.fireCtrlEquipmentDue"
                label="消防设备到期时间"
              />
              <van-field
                v-if="formParams.companyType === 'd05'"
                readonly
                required
                v-model="formParams.locationClassificationName"
                label="九小场所分类"
              />
            </van-collapse-item>
            <van-collapse-item size="large" title="负责人信息" name="3">
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.legalPerson"
                label="法定代表人"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.legalPersonIdTypeName"
                label="法定代表人证件类型"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.legalPersonIdCard"
                label="法定代表人证件号"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.legalPersonPhone"
                label="法定代表人联系电话"
              />
              <van-field readonly label-class="van-cell__title_gray" v-model="formParams.operator" label="实际经营人" />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.operatorIdTypeName"
                label="实际经营人证件类型"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.operatorIdCard"
                label="实际经营人证件号"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                v-model="formParams.operatorPhone"
                label="实际经营人联系电话"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                label="上传照片"
                required
                :label-width="300"
                :border="false"
              />
              <van-field
                readonly
                label-class="van-cell__title_gray"
                class="van-field__value--upload"
                input-align="left"
              >
                <template #input>
                  <van-uploader disabled>
                    <div class="van-uploader__input--yellow-small">
                      <van-image
                        width="82px"
                        height="102px"
                        fit="cover"
                        style="border-radius: 12px"
                        :src="$config.ImageURl + formParams.companyImage"
                      />
                    </div>
                  </van-uploader>
                </template>
              </van-field>
            </van-collapse-item>
          </van-collapse>
          <div style="padding: 16px"></div>
        </van-form>
      </van-sticky>
    </div>
  </div>
</template>
<script>
import Resident from '@/api/resident'
export default {
  data() {
    return {
      activeNames: ['1', '2', '3'],
      formParams: {}
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    getDetail() {
      Resident.BaseInfo.companyDetail({
        companyCode: this.$route.query.companyCode
      }).then(res => {
        const { status, data } = res.data
        if (status === 0) {
          this.formParams = { ...data }
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import '~@/assets/style/resident/detail.less';
</style>
